#ifndef __LightShapeRenderNode_h__
#define __LightShapeRenderNode_h__
#pragma once

class CRELightShape;

//////////////////////////////////////////////////////////////////////////
// RenderNode for rendering single light shape object.
//////////////////////////////////////////////////////////////////////////
class CLightShapeRenderNode : public ILightShapeRenderNode, public Cry3DEngineBase
{
public:


	CLightShapeRenderNode();

	//////////////////////////////////////////////////////////////////////////
	// Implements ILightShapeRenderNode
	//////////////////////////////////////////////////////////////////////////
	VIRTUAL bool LoadLightBox();
	VIRTUAL bool LoadLightShape( const char *sLightShapeFilename, const uint32 nLSFlags );
	VIRTUAL void SetLSFlags( const uint32 nNewFlags );
	uint32 GetLSFlags() const { return m_nLSFlags; }

	//////////////////////////////////////////////////////////////////////////
	// Implements IRenderNode
	//////////////////////////////////////////////////////////////////////////
	virtual void GetLocalBounds( AABB &bbox );
	virtual void SetMatrix( const Matrix34& mat );
	const Matrix34& GetMatrix( ) const { return m_matrix; }

	virtual EERType GetRenderNodeType() { return eERType_LightShape; }
	virtual const char * GetEntityClassName() const { return "LightShape"; }
	virtual const char *GetName() const { return "LightShape"; }
	virtual Vec3 GetPos( bool bWorldOnly = true ) const { return m_pos; };
	virtual void Render( const SRendParams &rParam );
	virtual IPhysicalEntity *GetPhysics() const { return 0; }
	virtual void SetPhysics(IPhysicalEntity *) {}
	virtual float GetMaxViewDist();
	virtual const AABB GetBBox() const { return m_WSBBox; }
	virtual void SetBBox( const AABB& WSBBox ) { }
	virtual void OffsetPosition(const Vec3& delta);
	virtual void SetMaterial( IMaterial *pMat ) {}
	virtual IMaterial* GetMaterial(Vec3 * pHitPos = NULL){ return NULL; }
	virtual IMaterial* GetMaterialOverride() { return NULL; }
	//////////////////////////////////////////////////////////////////////////

	bool CheckIntersection(const Vec3& p1, const Vec3& p2);

	bool IsSerializeable() const { return m_bSerialize; }
	void GetMemoryUsage( ICrySizer *pSizer ) const
	{
		pSizer->AddObject(this, sizeof(*this));
	}
private:
	~CLightShapeRenderNode();

private:
	Vec3 m_pos;
	Matrix34 m_matrix;
	AABB m_bounds;

	CRELightShape *m_pLightShapeRenderElement;
	CRenderObject *m_pRenderObject;
	_smart_ptr<IStatObj> m_pStatObj;

	AABB m_WSBBox;

	bool m_bSerialize;

	uint32	m_nLSFlags;
};


#endif // __LightShapeRenderNode_h__
